<template>
	<!-- 自定义时间选取 -->
	<view>
		<picker mode="date" :fields="fields" :value="dateVal" :start="startDate" :end="endDate" @change="dateChange">
			<view class="pickerBtn">
				选择
			</view>
		</picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dateVal: "",
			}
		},
		props: {
			fields: {
				type: String,
				default: "day"
			},
			startDate: {
				type: String,
				default: "2000-01-01"
			},
			endDate: {
				type: String,
				default: "2999-12-31"
			}
		},
		mounted() {

		},
		methods: {
			// 日期起修改
			dateChange(e) {
				this.dateVal = e.detail.value
				this.$emit("dateChange", this.dateVal)
			},
		}
	}
</script>

<style>
	.pickerBtn {
		padding: 10rpx 20rpx;
		background-color: #4285f4;
		border-radius: 50rpx;
		color: #ffffff;
		font-size: 24rpx;
	}
</style>